﻿using HY.DataAchieve;
using HY.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HY.Service
{
    public class SysUserService : BaseService
    {
        public V_UserInfo GetV_UserInfo(int userID)
        {
            string sqlStr = "SELECT SU.ID UserID,SU.UserName,SD.ID DeptID,SD.DeptName,SR.ID RoleID,SR.RoleName FROM SysUser SU LEFT JOIN SysDept SD ON SU.DeptID=SD.ID LEFT JOIN SysRole SR ON SU.RoleID=SR.ID WHERE SU.ID=@ID";
            using (UnitOfWork unit = new UnitOfWork())
            {
                V_UserInfo v_UserInfo = unit.Dapper().QueryFirstOrDefault<V_UserInfo>(sqlStr, new { ID = userID });
                return v_UserInfo;
            }
        }
    }
}
